﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <title></title>
    <link href="Content/css/bootstrap.min.css" rel="stylesheet">
    <link href="Content/css/main.css" rel="stylesheet">
    <script src="Scripts/js/jquery.min.js"></script>
    <script src="Scripts/js/bootstrap.min.js"></script>
    <script src="Scripts/js/icheck.min.js"></script>
    <script src="Scripts/js/main.js"></script>
    <style type="text/css">
        body, html, #allmap {
            width: 100%;
            height: 100%;
            overflow: hidden;
            margin: 0;
            font-family: "微软雅黑";
        }
    </style>
    <!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=tFVX4wxYeATFkTjUUeHoQeYv"></script>-->
    <!--  -->
</head>
<body>
    <div class="container-fluid navbar-fixed-top top-bar">
        <div class="container-title">
            <div class="container-title-back"><a href="#"></a></div>
            <div class="container-title-main">备案点位置</div>
        </div>
    </div>
    <div class="clear50"></div>
    <div id="allmap">
    </div>
</body>
</html>
<script type="text/javascript">
    function GetRequest() {
        var url = location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for(var i = 0; i < strs.length; i ++) {
                theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }
    function init() {
        var Request = new Object();
        Request = GetRequest();
        var xy = Request["point"];
        var xy4 = xy.split(",");
        var x = xy4[0];
        var y = xy4[1];
        var map = new BMap.Map("allmap");
        var point = new BMap.Point(x, y);
        map.centerAndZoom(point, 15);
        var marker = new BMap.Marker(point);  // 创建标注
        map.addOverlay(marker);               // 将标注添加到地图中
        //marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
        map.enableScrollWheelZoom(true);//启用滚轮放大缩小
        map.addControl(new BMap.ScaleControl());
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function (r) {
            if (this.getStatus() == BMAP_STATUS_SUCCESS) {
                var mk = new BMap.Marker(r.point);
                var p2 = new BMap.Point(r.point.lng, r.point.lat);
                map.centerAndZoom(r.point, 16);
                var driving = new BMap.DrivingRoute(map, { renderOptions: { map: map, autoViewport: true } });
                driving.search(p2, point);
                //addMarker(xy4);
            }
            else {
                alert('failed' + this.getStatus());
            }
        }, { enableHighAccuracy: true })
    }
    $(function () {
        //百度地图API功能
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://api.map.baidu.com/api?v=2.0&ak=Hl4U00mw93xoS1kSDnqk8P6t&callback=init";
        document.body.appendChild(script);
    })
</script>